use askama::Template;
use axum::response::IntoResponse;

use crate::domain;
use crate::template::filters;
use crate::{config::AppContext, domain::topic::Topic, XmlTemplateResponse};

#[derive(Template)]
#[template(path = "sitemap.xml")]
pub struct SitemapTemplate {
    topics: Vec<Topic>,
}
pub async fn index() -> impl IntoResponse {
    let rb = AppContext::rbatis();
    let topics = domain::topic::select_sitemap(rb).await.unwrap();
    let template = SitemapTemplate { topics };
    XmlTemplateResponse(template)
}
